'use strict'

class save {
  constructor() {
    this.param = '/'
  }

  async post(c) {
    let data = JSON.parse(c.body)
    let a = c.service.fun;
    //console.log(data)
    let {user_id} = data[0];
    let {article_title,article_txt,article_img,article_time} = data[1];
    //console.log(article_title)
    c.setHeader('content-type', 'text/html; charset=utf-8')
    await a.add('draft_list',{'draft_user_id':user_id,'draft_img':article_img,'draft_time':article_time,'draft_title':article_title,'draft_txt':article_txt},c.service.pool);
    c.send({
      type:'success',
      data:'ok'
    })
  }  
}

module.exports = save;

